<?php $this->extend('comm/page');?>

<?php $this->block('css'); ?>
<style>
    .table-title-name {
        font-weight: 600;
        font-size: 15px;
    }
</style>
<?php $this->blockEnd(); ?>


<?php $this->block('js'); ?>
<script>
window.tableAuth = '<?php echo $tableAuth; ?>';
window.dictionaryAuth = '<?php echo $dictionaryAuth; ?>';
</script>
<?php $this->blockEnd(); ?>

<div class="panel panel-default panel-intro">
    <?php echo $this->build_heading(); ?>
    <div class="panel-body">
        <div id="backup">
            <div class="table-title-name">数据库备份记录</div>
            <table id="backupTable" lay-filter="backupTable" class="mr-b-sm"></table>
        </div>
        <?php if($tableAuth): ?>
        <div id="tableList">
            <div class="table-title-name">数据库表</div>
            <table id="table" lay-filter="table" class="mr-b-sm"></table>
        </div>
        <?php endif; ?>
    </div>
</div>


<!-- 操作 -->
<script type="text/html" id="operate">
    <?php if($this->checkAuth('/admin/sys/backup/import', $userInfo['id'])): ?>
        <button type="button" class="btn btn-xs btn-info" lay-event="import"><i class="fa fa-floppy-o"> 导入</i></button>
    <?php endif; ?>
    <?php if($this->checkAuth('/admin/sys/backup/del', $userInfo['id'])): ?>
        <button type="button" class="btn btn-xs btn-danger" lay-event="del"><i class="fa fa-times"> 删除</i></button>
    <?php endif; ?>
    <?php if($this->checkAuth('/admin/sys/backup/download', $userInfo['id'])): ?>
        <button type="button" class="btn btn-xs btn-default" lay-event="download"><i class="fa fa-download"> 下载</i></button>
    <?php endif; ?>
</script>

<script type="text/html" id="table-operate">
    <?php if($this->checkAuth('/admin/sys/backup/field', $userInfo['id'])): ?>
        <button type="button" class="btn btn-xs btn-success" lay-event="field"><i class="fa fa-eye"> 详细信息</i></button>
    <?php endif; ?>
</script>

<script type="text/html" id="table-toolbar">
    <div class="layui-btn-container">
        <?php if($this->checkAuth('/admin/sys/backup/save', $userInfo['id'])): ?>
        <button class="layui-btn layui-btn-sm layui-btn-primary" lay-event="backup">备份表</button>
        <?php endif; ?>
        <?php if($this->checkAuth('/admin/sys/backup/optimize', $userInfo['id'])): ?>
        <button class="layui-btn layui-btn-sm layui-btn-primary" lay-event="optimize">优化表</button>
        <?php endif; ?>
        <?php if($this->checkAuth('/admin/sys/backup/repair', $userInfo['id'])): ?>
        <button class="layui-btn layui-btn-sm layui-btn-primary" lay-event="repair">修复表</button>
        <?php endif; ?>
    </div>
</script>